package edu.lingnan;

import edu.lingnan.config.MyThreadConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@MapperScan("edu.lingnan.mapper")
@EnableScheduling
@EnableSwagger2
@Slf4j
public class LmspaceplusApplication {

    public static void main(String[] args) {
        SpringApplication.run(LmspaceplusApplication.class, args);
        log.info("项目启动成功……");
    }

    // @Bean
    // public ServletWebServerFactory servletContainer() {
    //
    //     TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
    //
    //         @Override
    //         protected void postProcessContext(Context context) {
    //
    //             SecurityConstraint securityConstraint = new SecurityConstraint();
    //             securityConstraint.setUserConstraint("CONFIDENTIAL");
    //             SecurityCollection collection = new SecurityCollection();
    //             collection.addPattern("/*");
    //             securityConstraint.addCollection(collection);
    //             context.addConstraint(securityConstraint);
    //         }
    //     };
    //     tomcat.addAdditionalTomcatConnectors(initiateHttpConnector());
    //     return tomcat;
    // }

    // @Bean
    // public Connector initiateHttpConnector() {
    //     Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    //     connector.setScheme("http");
    //     connector.setPort(8080); // http端口
    //     connector.setSecure(false);
    //     connector.setRedirectPort(443); // application.properties中配置的https端口
    //     return connector;
    // }


}
